import React, { useEffect, useRef } from 'react'

// 获取真实 dom 元素
const UseRefComponent: React.FC = () => {
  const userRef = useRef<HTMLInputElement>(null)
  useEffect(() => {
    console.log(userRef.current)
    userRef.current?.focus() // 获取焦点
  }, [])
  return <input type="text" ref={userRef} />
}
export default UseRefComponent
